
<script type="text/javascript">
KindEditor.ready(function(K) {
				var editor = K.editor({
					 uploadJson : "index.php?g=User&m=Upload&a=index",//图片上传后的处理地址
                    //fileManagerJson : 'Public/js/kindeditor/php/file_manager_json.php',
					allowFileManager : true
				});
				//上传头像
				
				
				//上传首页
				K('#pic_js').click(function() {
					editor.loadPlugin('image', function() {
						editor.plugin.imageDialog({
							showRemote : false,
							clickFn : function(url, title, width, height, border, align) {
								K('#pic').val(url);
								
								 document.getElementById("win_pic").src=url;
								editor.hideDialog();
							}
						});
					});
				});
})
</script>

<div class="userinfo">
<script type="text/javascript" src="__PUBLIC__/Js/jquery.artDialog.js?skin=default"></script>
    <load href="./__PUBLIC__/Js/iframeTools.js"/>
    <load href="./__PUBLIC__/Js/my.js"/>
    <load href="./__PUBLIC__/Js/swfupload.js"/>  
 	<script type="text/javascript" src="./__PUBLIC__/Js/MyDate/WdatePicker.js"></script>
    <script type="text/javascript" src="./Public/js/jgsat.js">
	
      var APP	 ='__APP__'
      var ROOT   ='__ROOT__'
      var PUBLIC = '__PUBLIC__'
     </script>
    <div class="wind_content1R">
      <span class="wind_content1Rspan">个人资料</span>
      <ul class="wind_content1Rspanson" style="float:right;margin: -32px 20px 0px 0px;">
        <li>完善度</li>
        <li style="margin-top:3px;width:100px;height:10px;background:#DFDFDF;">
          <span id="spanwidth" style="display:block;width:0px;height:10px;background:#DD4F50;"></span>
        </li>
        <li><span id="wind_nius">0</span>%</li>
      </ul>
      <ul class="wind_content1RULs1">
      <form method='post' id="myform2"  action="{:URL('User-Index/designer')}" onsubmit="return change_info()">
        <li>
            <span style="width:167px;">身份类型：设计师</span>
        </li>
        <input type="hidden" name="id" value="{$vo.id}" />
        <li style="margin-top:0px;">
            <span><a style="color:red;">*</a> 真实姓名：</span>
            <dd><input type="text" disabled="disabled" name="realname" id="name1" size="12" value="{$vo[realname]}" validate=" required:true"/></dd>
        </li>
        <li>
            <span><a style="color:red;">*</a> 毕业院校：</span>
           <dd> <input type="text" name="school" id="name2" size="12" value="{$vo[school]}" validate=" required:true"/></dd>
        </li>
        <li>
               <span><a style="color:red;">*</a> 设计经验：</span>
               <dd> <select name="experience"  id="name3" validate=" required:true">
                        <option value="">请选择</option>
                            <?php  $_result=M("Type")->field("*")->where("keyid=25 and typeid!=25")->order('listorder asc')->select(); foreach($_result as $key=>$r):?>
                                 <?php $seled = $vo[experience]==$r['typeid'] ? 'selected="selected"' : ' ';?>
                        <option value="{$r['typeid']}" {$seled}>{$r['name']}</option>
                            <?php endforeach;?>
                   </select>
               </dd>
        </li>
        <li>
            <span><a style="color:red;">*</a> 所在地：</span>
            <dd><select name="province" id="province" validate=" required:true" onchange="area_change(this.value, 1,'province','city','area');" class="selt mr5" >
            	<option value="0">省份</option>
            </select>
            <select name="city"  id="city" validate=" required:true" onchange="area_change(this.value, 2,'province','city','area');" id="city" class="selt mr5" >
                <option value="0">城市</option>
            </select>
           
            <script>area_change(0, 0,'province','city','area',{if $vo[province]!=0}{$vo[province]}{else}0{/if},{if $vo[city]!=0}{$vo[city]}{else}0{/if},{if $vo[area]!=0}{$vo[area]}{else}0{/if});
			</script>
	    </li>
        <li>
            <span>&nbsp;</span>
            <input type="text" name="address" id="address" class="orderinput" value="{$vo[address]}" />
            </dd>
        </li>
        <li>
            <span><a style="color:red;">*</a> 收费标准：</span>
                <dd><select name="charge" id="name6" validate=" required:true">
                      <option value="">请选择</option>
                          <?php  $_result=M("Type")->field("*")->where("keyid=34 and typeid!=34")->order('listorder asc')->select(); foreach($_result as $key=>$r):?>
                            <?php $seled = $vo[charge]==$r['typeid'] ? 'selected="selected"' : ' ';?>
                      <option value="{$r['typeid']}" {$seled}>{$r['name']}</option>
                           <?php endforeach;?>
                </select></dd>
            <img style="vertical-align: middle;" src="../Public/images/order2.png" />
        </li>
        <li>
            <span>QQ：</span>
            <input name="qq" type="text" id="name7"  value="{$vo[qq]}" /> 
        </li>
        <li>
            <span>荣誉资质：</span>
            <textarea class="wind_textar1"  name="reward" id="name8">{$vo[reward]}</textarea>
        </li>
        <li><?php $itemType=explode(",",$vo['itemType']); ?>
            <span><a style="color:red;">*</a> 擅长空间：</span>
            <div class="wind_orderdiv">
              <ul>
               <YP:list name="Label" where="genre=17" id="r" limit="50">
               <?php $seled = in_array($r['id'],$itemType) ? 'checked="checked"' : '';?>
                <li>
                  <input name="itemType[]" type="checkbox"  validate=" required:true" {$seled} class="choice" value="{$r['id']}">{$r['title']}
                </li>
                 </YP:list>
               </ul>
            </div>
            <div style="clear:both;"></div>
        </li>
        <li>
            <span>自我介绍：</span>
            <textarea name="my_introduce" class="wind_textar1"  id="name10">{$vo[my_introduce]}</textarea> 
        </li>
        <li style="margin-top:0px;">
            <span style="color:red;font-size:12px;line-height:20px;width: 230px;">（带 * 为必填选项）</span>
        </li>
        <li>
          <input type="hidden" id="avatar" name="avatar"  value="{$vo.avatar}"/>
           <input type="hidden" id="pic" name="pic"  value="{$vo.pic}"/>
          <input type="submit" name="dosubmit" value="保存" class="wind_sub1" />
        </li>
        </form>
      </ul>
      <div class="wind_myhead">
          <div class="wind_myhead_son">
            <img width="100" height="100" id="win_avatar" src="{$vo.avatar}" style="border-radius:6px;margin:21px;" />
            <a href="index.php?g=User&m=Index&a=avatar"><span class="wind_myhead_son2" id="avatar_js">上传头像</span></a>
            <span style="color:#F00">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
          </div>
          
          
          <ul class="wind_XX">
            <li><span class="wind_XXspan">绑定邮箱：{if $vo[email]}{$vo[email]} {else} 未设置{/if}</span></li>
            <!--<li><span class="wind_XXspan">绑定手机：178***89</span></li>-->
            <li><span class="wind_XXspan">登录密码：*******</span></li>
          </ul>
          <ul class="wind_XX2">
            <li>{if $vo[email]}<a style="color:#F00"  href="javascript:email_edit()"> 解绑</a>{else} <a style="color:#F00"  href="javascript:email()">立即设置</a>{/if}</li>
            <li><a style="color:#F00" href="index.php?g=User&m=Register&a=edit">修改密码</a></li>
          </ul>
          <div class="wind_myhead_son"  style="margin-top:80px; height:500px;">
            <img width="100" height="400" id="win_pic" src="{$vo.pic}" style="border-radius:6px;margin:17px;" />
            <span class="wind_myhead_son2" style=" width:120px;" id="pic_js">上传首页推荐背景</span>
            <span style="color:#F00">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(建议尺寸 100*500)</span>
          </div>
      </div>
    </div>
    <div style="clear:both;margin-bottom:20px;"></div>
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){
    wancheng();
});
 function wancheng(){  
     var num=0;
	 if($("#name1").val()){
		  num+=10+num;
		  
		 }
	 if($("#name2").val()){
		  num=10+num;
		 }	 
     if($("#name3").val()){
		  num=10+num;
		 }
     if($("#city").val()){
		  num=20+num;
		 }
	 
	  if($("#name6").val()){
		 num=10+num;
		 }
	  if($("#name7").val()){
		  num=10+num;
		 }
	   if($("#name8").val()){
		 num=10+num;
		 
		 }
		 if($(".choice[type='checkbox']").is(':checked')==true){
		num=10+num;
		 }  
		if($("#name10").val()){
		num=10+num;
		 }  
		 
    
	$("#spanwidth").css("width",num+"px");
    $("#wind_nius").text(num);
  
 }
 
 
 
 function  email_edit(){
	 
	
    var html=' ';
	html+='<form method="post"  id="form1" action="/index.php?g=User&m=Index&a=delemail" onsubmit="return mailcheckform()">';
	html+='<ul class="wind_zhuce1 yzm_tan" <li>邮箱号码：</li>';
	html+='<input name="mail" type="hidden"  value="{$vo[email]}"  />';
	html+='<li><dd><input type="text" id="email"  placeholder="邮箱号码" disabled="true"  value="{$vo[email]}"   class="reg-form-input rf-input-l" />';
	html+='</dd><a href="#" class="code-box" id="btn_fahou">';
	html+='<input type="button"  style="width: 150px;" class="wind_spans4" value="发送验证码" />';

	
	html+='</a></li><li>邮箱验证码：</li><li><dd>';
	html+='<input type="text" name="verify" class="reg-form-input rf-input-s" id="emyzm"  placeholder="请输入验证码"  />';
	html+='</dd></li><li><input  class="yzm_sub" type="submit" style="cursor: pointer"  value="立即解绑"  /></li></ul></form>';
	 
	 layer.open({
	  type: 1,
	  title :'解绑邮箱',
	  skin: 'layui-layer-rim', //加上边框
	  area: ['420px', '340px'], //宽高
	  content: html
	});
	 }
	 
	function  email(){
	 
	
    var html=' ';
	html+='<form method="post"  id="form1" action="/index.php?g=User&m=Index&a=addemail" onsubmit="return mailcheckform()">';
	html+='<ul class="wind_zhuce1 yzm_tan" <li>邮箱号码：</li>';
	html+='<li><dd><input type="text" id="email" name="mail" placeholder="邮箱号码"  class="reg-form-input rf-input-l" />';
	html+='</dd><a href="#" class="code-box" id="btn_fahou">';
	html+='<input type="button"  style="width: 150px;" class="wind_spans4" value="发送验证码" />';

	
	html+='</a></li><li>邮箱验证码：</li><li><dd>';
	html+='<input type="text" name="verify" class="reg-form-input rf-input-s" id="emyzm"  placeholder="请输入验证码"  />';
	html+='</dd></li><li><input  class="yzm_sub" type="submit" style="cursor: pointer"  value="立即绑定"  /></li></ul></form>';
	 
	 layer.open({
	  type: 1,
	  title :'绑定邮箱',
	  skin: 'layui-layer-rim', //加上边框
	  area: ['420px', '340px'], //宽高
	  content: html
	});
	 } 
	 
	 
	$('.wind_spans4').live("click",function(){
       var mail = $.trim($('#email').val());
       var partten = /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
	   //alert(mail)
	  if(partten.test(mail)){
		  $.post('index.php?g=User&m=Index&a=email', {'mail':mail},function(res){
               alert(res);
			  
			  
           });
		 }else{alert('邮箱格式不正确')}
    }); 
	 

function mailcheckform () {
	var email=$("#email").val();
	var emyzm=$("#emyzm").val();
	var partten = /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
	  if(partten.test(email)==false){
		 alert('邮箱格式不正确');
		  return false;
		  }
		
	
	  if(email==''){
		  alert('邮箱不能为空');
		  return false;
		  }
	   if(emyzm==''){
		  alert('验证码不能为空');
		  return false;
		  }	  
	
	}	
	
	
	function change_info(){
	var username=$("#name1").val();
	var school=$("#name2").val();
	var experience=$("#name3").val();
	var city=$("#city").val();
	var charge=$("#name6").val();	
	var choice=$(".choice").val();	
	//alert($(".choice").attr('checked'));
	var arr ; 
	$('.choice:checkbox').each(function() {
		if ($(this).attr('checked') =='checked') {
              arr= $(this).val();
        }
     });
	
	//alert(arr)
	//return false;
	    if(city==0)
        {
            alert("请选择您所在的城市!");
            return false;
        }
		
		if(typeof(arr)=="undefined")
        {
            alert("请选择您擅长的空间!");
            return false;
        }
		if(username=='')
        {
            alert("请输入您的真实姓名!");
            return false;
        }
		
		if(school=='')
        {
            alert("请输入您的毕业院校!");
            return false;
        }
		if(experience=='')
        {
            alert("请选择您的设计经验!");
            return false;
        }
		if(charge==''){
			alert("请选择您的收费标准!");
            return false;
			}   
	 
	 
		} 
</script>
<div class="clear:both;"></div>
